He was looking for places to burgle at about 5am when he saw an open window at a second-storey walk-up unit.
Muhammad Sutarno Nasir climbed up a pole that was connected to the ground, grabbed hold of the shophouse's laundry pole holders and lifted himself through the window.
After ransacking the living room, he went into a bedroom where he saw a woman sleeping on a mattress and decided to rape her.
Muhammad Sutarno tried to strangle the 27-year-old victim, and repeatedly punched her in the face when she shouted and struggled.
Fearing for her life, the woman, who lived with her 75-year-old grandmother, pretended to pass out while he raped her.
After the attack, Muhammad Sutarno took the handbags of the victim and her grandmother, and left through the door using the elderly woman's key.
Left without her phone, the victim sought help via Facebook, posting several pleas on her Facebook wall between 5.17am and 5.30am.
A friend responded two minutes after her last post and the police arrived at the scene at about 6am.
Muhammad Sutarno, who has previous convictions for drug offences and misappropriation of property, was arrested more than four hours after the attack on July 24 last year. He was found to have drug-taking utensils in his pocket.
Yesterday, Muhammad Sutarno, now 30, was sentenced to 21 years' jail and 18 strokes of the cane after he pleaded guilty to one count each of aggravated rape and housebreaking. He also pleaded guilty to an unrelated charge of heroin possession. Five other charges - two for housebreaking and three for drug offences - were taken into consideration.
In sentencing, Justice Chan Seng Onn told Muhammad Sutarno that words cannot fully express how much pain and suffering he had inflicted on the victim.
"You have wrecked her life," said the High Court judge.
Apart from bruises and abrasions on her face and neck, the violence left the woman with lesions in her brain, indicating acute bleeding, prosecutors told the court.
The court also heard that her fiance broke up with her because of the rape, reinforcing her thoughts that she is "unworthy of others".
The woman still suffers from post-traumatic stress disorder. She sleeps with the light on and wakes up often to check for intruders. She keeps a pair of scissors beside her to defend herself. She also blames herself for moving into a separate bedroom from her grandmother.
The woman, her grandmother and the location of the attack cannot be named due to a gag order to protect the victim's identity.