Support irregularly sized tiles

Tiles along layer edges can now be clipped to the layer size. This
saves memory along tile edges.