Place an object on a grid with rotation

This puts the blue cube at an intersection

But the problem is knowing which way to move the vectors

grid