This is the kind of quote that makes Shakespeare great! He manages to capture an absolute truth of life in a single sentence. The context of the quote is that Hamlet is talking to his friends Rosencrantz and Guildenstern and is still maintaining his crazy act. He makes the observation that Denmark is a prison because that seems crazy -- why would the prince of Denmark speak so negatively? Is this comment an indication of his deep melancholy? The friends challenge him and say they don't think it is a prison and his response is the quote from above. What he means is every person has the right to his or her perception of things and whether that perception is "true" or not is entirely up to the "perceiver." For example, I think sweet potatoes are gross. There is nothing anyone else can tell me that is going to make me change my mind. If my best friend thinks they are the best vegetable ever then I am never going to change her mind. Neither one of us is "right" -- because each of our own "thinking" makes it what it is for each of us. This is true for almost everything on which people would have an opinion.