So.... hue shader applied to the background, using the foreground as a mask, yes?
Keep in mind this will yield incorrect results when the background has composite transparency. I don't know if there is any way to use two foreground textures in a single effect, so I'd go with foreground/background only. You'd need two sprites: the image and the mask for the effect. It would change only one hue at a time.