How to persist APEX dialog size and position

As a developer I love how easy it is to create dialogs with APEX 5.0. But as a user I get a little annoyed that I have to move and resize them each time I open a dialog. Today I’ll show how to persist dialog position and size for the duration of a browser session.