Improved CubeAndTiles

Using dirty flags, shader optimizations, fewer multiplications, etc.