Haha, it turns out that once you understand things they are really easy to do.

[Linked Image from i.imgur.com]

For now I only have it working for the specific case in TNZS (16-bit layer with 4x zoom) but the code is generic enough that it should work with any configuration. Just have to do some testing...