I rotate the object in the html5 canvas around a variable point of origin.
If the user clicks on a given point in a newly rotated rectangle, I need the returned mouse coordinates to be rotated back around the same starting point.
I made a very quick drawing to hopefully illustrate better:

What I really need is a function that takes the actual coordinates of the mouse with the x and y coordinates and converts them to the position of the objects before it is rotated.
var origin = {
x: 100,
y: 100
};
var angle = 45;
function transformCoordinates(x,y){
//Perform calculation to transform coordinates
return {
x : newx,
y : newy
};
}
Available variables will be the origin of the rotation and angle transform. As well as the coordinate of the mouse click on the canvas (relative to the canvas itself, with 0,0 - top left point, etc.)
, . , - .