common: add aspect ratio helper code
This is sufficiently nontrivial and often-needed enough that providing helpers makes a lot of sense. Add some extra helpers that come up when rendering to sub-rects of targets.
The only annoying thing here is the mismatch between pl_rect2df and pl_rect2d. Maybe I can come up with a better API here?
Also update the sdl2 demo to actually preserve the aspect ratio, as well as add some test cases to the new helper functions.