Rewrite texture handling to support textures larger than 16x16 (in theor)