There is Material Parameter Collections feature which should suit your case.
You can add two Vector parameters (position and extent) and set them up in some blueprint (or just the defaults inside the MPC editor) and then use them as a base of calculations for your material.