scaling texture appears to move diagonally up/right

Hi, I have a texture on a plane that I’m scaling over time & would like the image to remain ‘centred’ but just change in size. Currently when it is scaling up (the image gets larger) the image appears to be moving up & to the right of the screen. What I would like is for the image in the centre of the screen to remain centred but just increase in size. This is the script I’m using:

using UnityEngine;
using System.Collections;

public class TextureScaling : MonoBehaviour {


        public Renderer rend;
       
        void Start() {
            rend = GetComponent<Renderer>();
           
    }

        void Update() {
        // zoom in
        float scaleX = rend.material.mainTextureScale.x -0.1f *Time.deltaTime;
        float scaleY = rend.material.mainTextureScale.y -0.1f*Time.deltaTime;
            rend.material.mainTextureScale = new Vector2(scaleX, scaleY);
       

        }
    }

Can anyone point me towards what I need to do to keep it centred?

Thanks

Offsetting the texture like below should keep it centred

using UnityEngine;
using System.Collections;

public class TextureScaling : MonoBehaviour {
    public float scaleRate = 0.1f;
    public Renderer rend;

    // Use this for initialization
    void Start () {
        rend = GetComponent<Renderer>();
    }
 
    // Update is called once per frame
    void Update () {
        float scaleX = rend.material.mainTextureScale.x - scaleRate * Time.deltaTime;
        float scaleY = rend.material.mainTextureScale.y - scaleRate * Time.deltaTime;

       //Add on half of the scale increase as an offset
        float offSetX = rend.material.mainTextureOffset.x + (scaleRate/2) * Time.deltaTime;
        float offSetY = rend.material.mainTextureOffset.y + (scaleRate/2) * Time.deltaTime;

        rend.material.mainTextureScale = new Vector2(scaleX, scaleY);
        rend.material.mainTextureOffset = new Vector2(offSetX, offSetY);
    }
}

Thanks. I didn’t even think of that, I thought I must’ve had something wrong. I’ll try it out tomorrow

it worked, thanks.