I am affraid that we will have to use math.
Rotate the point with a negative rotation angle to get your position on the rotated plane using this equation:
nX = x * cos(a) - y * sin(a)
nY = x * sin(a) + y * cos(a)
where a negative rotation value
Now your point is on a normal plane without rotation, so the rest of the logic is like angle = 0
Here is a demo for you:
http://jsfiddle.net/Q6dpP/5/
And here is the version with translation:
http://jsfiddle.net/Q6dpP/6/
source share