Avoid dividing by zero

If you rotate the paper around 70 degrees, then the diagonal will be
perfectly vertical. We don't deal with this since it's hard to
accidentally rotate the paper more than 45 degrees.
Tweaking

Optimize release binary for size, slight modification of MIN_BLACK, etc.