The key to understand transformations is to realize that they are always applied to the coordinate system and not to the object you are drawing. In order to draw a rotated (say) square you have first to ofRotate the CS then draw your square as usual. The same goes for translations and scaling.
To capture the mouse you have to store in a class variable the x (or y) position in the mousedown handler, then the same in mousemoved. When drawing compute the difference among the two and use it to rotate your object. There are other ways of course but this one is the simplest.
If you need to apply many transformations ofPushMatrix and ofPopMatrix come handy.