How would I apply a mask for pixel shading effect to restrict it only to some part of image? For example I have a height tile:

Now I want to apply the effect only on the tile-shape of this height-tile with some sort of masking:

Therefore, how would I restrict the pixel shading function boundary using masking?