I think this calculation can be simplified quite a bit. It also look like it's actually resulting in a padding of over 10px.

```
var dimension = Math.min([displayWidth, displayHeight]) - 20;
x1 = displayWidth / 2 - dimension / 2;
x2 = x1 + dimension;
y1 = displayHeight / 2 - dimension / 2;
y2 = y1 + dimension;
```