Thought this was an interesting challenge so I had a go at it. It's not perfect (the blocks sometimes go a little wonky), but otherwise it's fully-functional. I wouldn't usually make what's practically an entire game for people, but once I got started I realised it was actually really quick to do. The real challenge for you will be in creating compelling variants, and obviously tightening up the block movement.
Nothing fancy, just some drag-and-drop with the snap-to-grid system from my tower defence tutorial, and checking when things overlap. Be sure to pay attention to the collision polygons for each shape - those are the key to this thing working.
Here you go.
Enjoy!