Maybe your were doing something like ths:
1. Make the selection with the rectangular marquee tool as you described
![sel-1.jpg]()
2. Switch to the Magic Wand Tool
3. Hold down the Alt (Option) key and click on the background color within the selection
![sel-2.jpg]()
The Magic Wand Tolerance value can affect the selection