A court heard how married Gordon McDonald, 57, would meet one girl after school and drive her to a deserted industrial estate where they would strip naked.
After performing indecent acts on each other, he would drive her home, dropping her off just round the corner from her house.
Eventually, the girl told a teacher and police began a major investigation.
At the High Court in Edinburgh yesterday, McDonald, of Cuiken Terrace, Penicuik, pleaded guilty to 13 charges.
He admitted rape, indecency, meeting or arranging to meet girls under 16 for sex and possessing a stash of child porn – some of it graded at the worst end of a recognised scale of depravity.
When he returns to court in September, McDonald could face a life sentence – one of the first under new rules to give judges greater powers.