Wayne Rooney will join Derby County in January at the end of the MLS season.