x&=~15;
y&=~15;
x = mouse_x & ~15;
y = mouse_y & ~15;
If the grid is a power of 2 (e.g., 2, 4, 8, 16, 32, 64) then you can do this by subtracting 1 from the grid size. ...Bit now we're just talking about various ways to do the same thing. lol
If you don't use a mouse, just move in grid increments to begin with.