This could be a way to do it:
Just replace centerx/centery with the imagepoint x/y.
I loved what you have shared here and it have helped a lot but i am not able to solve the same equation if i want rotation to be anti-clockwise.
i have replied to the post in the link you shared, i thought i was not clear there so i m posting here
can you please post an equation that would do the same but for anti-clockwise rotation
it would be a real help as my game mechanism depend completely on it.
Thank you in advance!