Click and drag coloured boxes

Hi, Im trying to work out how i can reset a movieclip when theyre piled on each.

so far I have the 4 colours and 4 boxes you can drag them to, when you drop out side they reset but when dropped on a box they stack.

what i would like to do, is when theyre dropped onto a box the original box is then reset, replacing it with the new box, the old colour is then returned to its original location

Update: I could get them to go back when dropped on, but now i cant get the boxes to snap back into place when not on a box :s

File attached

Thankyou