Re-enable subimage optimization with scaling fix.

Thanks go to @Squall-Leonhart for finding the issue.
Merge pull request #2249 from unknownbrackets/texcache

Re-enable subimage optimization with scaling check