Support irregularly sized tiles

Tiles along layer edges can now be clipped to the layer size. This
saves memory along tile edges.
We generally try to stick to a 100-column line, although we sometimes fail.