How do this material and texture work?

What you posted is how to use texture atlases with material functions.

HLSL shader code should be like this: