You could project a ray from screen to cursor that passes through the grid. Then calculating the point where it goes through the grid plane. Assuming this was freely rotatable 3D world? Implementation of this depends now of used graphics engine.

Edit: Hmm.. maybe that was not asked

Maybe this helps:
Code:
// Rotate point around (cx, cy) 
// Angle in radians
procedure Rotate(var px,py: double; _angle,cx,cy: double);
var et,k: double;
begin
  et:=hypot(py-cy,px-cx);
  k:=arctan2(py-cy,px-cx)+_angle;
  px:=cx+cos(k)*et; py:=cy+sin(k)*et;
end;