Improve text selection by giving all text elements a right and bottom padding,
that pads the element right to the nearest right and bottom element.

Calculating the proper amount of padding is not straightforward. To do so,
we must find the nearest right and nearest bottom element, which can be an
O(N^2) operation if it is done naively. Instead, we use a quadtree data
structure which makes it easy to do lookups based on location.

Also add a number of tests for the quadtree.