Add geometry.js library, to handle rectangles and points
Add a normalized() function to a rectangle like in http://harmattan-dev.nokia.com/docs/library/html/qt4/qrectf.html#normalized.
This function returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height.