How to both crop and pan a texture in material

Frac, Floor and Ceil material expressions will help you. You can take a look at flibook material function and adapt what is in there for your needs.