-Resize your picture to however big or small you want each piece of the rainbow to be.
-make sure to have two copies of your square pasted into psp or whatever program you're using. Flood fill the spare image with whatever color you want.
-Select the unflooded image. Go up to Colors -> Gray Scale. This will turn your image into shades of black & white (if it was already black and white to begin with, skip this step). Then go back to Colors -> Increase Color Depth -> 16 million colors (24bit).
-Once you've done that, copy the image you had previously filled with color, and paste it onto the black & white image as a new layer. Then just adjust the opacity of the layer to however you like it.
-Lastly (and this is important) go up to Layers -> Merge -> Merge All (flatten). Once you've merged the two layers, you can copy and paste the rainbow square into an open paint window.
Repeate this process until you have all the colors you want.