These were all words used to describe a person whose IQ was below 70. More specifically, those who had an IQ between 0 and 25 were idiots, those between 26 and 50 were deemed imbeciles, and those scoring between 51 and 70 were considered morons.
It wasn't long, however, before they all became commonly used as insults. Therefore, the term 'retarded' was used to replace them, since its Latin root has the innocent meaning of "to make slow, delay, or hinder." Naturally, history repeated itself, and that too became a derogatory word.