In act IV of The Merchant of Venice, Shylock can be thought of as both, villain and victim. One reason for the role of victim is that he loses his ability to practice his faith via Antonio's order for Shylock to become Christian. This may not seem like a big deal but if considered within the scope of the play and all that he loses throughout the play, the loss of practicing his Jewish faith is the last straw. Consider he is an older man, with no one but his daughter and his identity as a Jew in the Jewish community. He then loses his daughter- Jessica, to her Christian love interest. Also, at the time, many Jews had to suffer the abuse of non-Jews created by anti-Semitism and stereotypes held at the time. The loss of his religion is a loss of his life.
However, Shylock's actions are what place him in the category of villain as well. He not only offers unconventional terms to Antonio's bond- the pound of flesh (no more no less), but even rejects the initial Duke of Venice's ruling on the matter. Shylock could have been happy that the Duke acknowledged that Shylock was legally valid in his claim but this did not satisfy Shylock. Shylock was also not satisfied when Bassanio offered money to repay Antonio's loan.
I think that when one analyzes this play one must take into account the audience that Shakespierre would play to and the political and religious climate.
While on the surface Shylock is a horrible villian who has no mercy or compassion one has to realize the subtext of 16th Century Europe and the power of the Church at that time which had considerable influence over the Kings especially in England where the Bishoprics were engaged in collecting taxes for the crown. Shakespeare had to portray the Jewish Shylock in this light or could have faced censure or worse.
I think instead you need to look past the superficial characterizations to understand the subtext. Shylock is protrayed as characterization of the stereo type n purpose. His character is drawn so heavily to exaggerate the bigotted notions that the some Christian Nobility had for Jews at the time that his speeches could if one reads them carefully enough to be a commentary on that very bigotry.
The line in the speech that starts "Prick us do we not bleed" where Shylock states Does not the same Sun shine on Christian and Jew alike (I am paraphrasing I misremember the exact quote) subtlely turns the honus of who is villian the other way. It states to the Nobles who were categorizing Jews in this light to the people and who where forcing them to live in ghettos and not allowing a Jewish person to own land look at what your policies turns people into. It begs the question why would Shylock show you mercy when you fail to see that you are depriving him. You even fail to recognise it. Sure the Jews response in this case may be wrong but given your treatment of him you are somewhat responsible. One of the many reasons Jews in the middle ages hoarded money was because they never new when they would have to bribe some Noble or King in order to avoid a pogrom. Thus their penny pinching in this case is driven not by greed but by fear and poaranoia and easily misunderstood.
There are many deeper meanings one can find in Shakespeares plays and you have to read them again and again to fully understand them. You also have to study the history of the time. It is not an easy task.
Just my thoughts