EDIT: The comment I was replying to was deleted. The point I was making is that different tranches in a CDO have different ratings. The lowest tranche (i.e. the ones that will suffer losses first, commonly referred to as the equity tranche) will effectively be rated as junk, while the top tranche (which would only suffer losses if every single other tranche had been wiped out, often called something like the "super senior" tranche), would be rated AAA.
Ratings are done at a bond (tranche) level, not a collateral level. Rating them at the collateral level would be incredibly stupid as some bonds are specifically designed to take loses in order to bolster the ratings of the senior bonds.
Also, the entire point in creating these structures is to introduce the multiple and very different risks. You start with collateral that is exposed to a bunch of different risks, and you end up with bonds that have only 1 specific and unique risk (in theory). Then whoever buys the bond only has to worry about hedging that one specific risk (or using it as a hedge for that specific risk) instead of trying to balance 5 or more different hedges.