After some weeks of dealing with jquery and the rectangle function i released earlier i wrote a new and cleaner version, renamed it to YDRjRectangle and put it into a plugin like shape, so everyone can implement further functionality for selecting objects or do other customizing to fit its needs.
If you want to use a technique like click & drag/mouse move you should get the disabletextselect plugin from jdempster, to get rid of unwanted text selection while drawing your div rectangle.
Here is the jsfiddle Project: http://jsfiddle.net/TqdMM/21
Please check out the older version of this script: http://marco-difeo.de/2011/06/13/jquery-rectangle-selection/
I’ve updated the jsfiddle to work with version 1.9+ of JQuery
Try out a demonstration