For the snapping you could do something like this:
for each object
pick grid closest to (object.x, object.y)
-- set object position to grid
For making a grid hold only one object you could add a variable to the grid objects to store the UID of the object that's on it. UIDs start at 0 so you could use a value like -1 to indicate the grid is empty.