2d rotation matrix...

In the situation where x,y lines on the x axis (y=0), it is clear to me why a=x*cos(theta) and b=-x*sin(theta), since x is the radius, and the values of a and b follow from Pythagoras. What I don't understand is how the extra y*sin(theta) ( for a) and y*cos(theta) (for b) in the above equations compensate for an arbitrary x,y not being on the axis.

Can someone explain this to me, or at least point me in the direction of a thorough proof (easy to follow) of the rotation matrix?