Didn't seek out the code (cant do that from here); but you might want to know that rotation always go around (0,0). So if you want to translate something that is at (x,y) with x != 0 != y You should translate the whole thing to (0,0), perform the rotation and translate it back. In fact, what you want is to translate the rotation axis to (0,0) because sometimes you don't want to rotate around the center.