The shape that I'm moving is a rectangle with width:40 and height:4, and this is what made the detection harder. It's easier when width = height (you can see the collision between the big rectangles).
In my case, I need to detect collision between this rectangle, and a group containing another rectangle, then add the small one to the group. Here's a fiddle to understand more: http://jsfiddle.net/4Y87X/6/
It works great when collision is detected on bottom, and on the right of the group, but the left and top borders are not well "detected".