Even though they may be marketed as such, deraillers are not speed-specific. As top506 said, all shimano (and shimano-compatible from other manufacturers) rear deraillers that were designed for indexed shifting have the same cable-pull ratio and thus are compatible with each other. You could use a Shimano 105 rear derailler from 1987, that came with six-speed indexed down-tube shifters and freewheel, with a 10-speed Ultegra drivetrain from 2007. (The only incompatibility here is Shimano 7- and 8-speed Dura-Ace, which has a different cable pull ratio from all other Shimano rear deraillers.)
The only thing that has to match are the speeds of your shifter and your cassette.