Fix a bug where legal texture coordinates could cause an exception

In short: we were multiplying (u * tex.width) to get an X coordinate
(and doing something similar for Y). This is improper, since the UV
coordinate u can be in the range [0,1] inclusive. We could potentially
try to access the array beyond the end.

The fix is to use (u * (tex.width - 1)) instead.