Four teen gangbangers savagely attacked and robbed a woman after tying her to a bed during a terrifying Brooklyn home invasion, sources said today.

The armed men in ski masks followed the woman’s 24-year-old boyfriend to their Bedford-Stuyvesant home around 12:45 p.m. Monday and forced him inside at gunpoint, police said.

They ordered the woman to the bathroom before moving her to a bedroom and tying her down, sources said. The ensuing sexual assault by all four of the thugs lasted about an hour — and one assailant even left to use a victim’s ATM card at one point, law enforcement sources said.

Surveillance video led to the capture of Christopher Scott, 17, Dezhaun Samuels, 18, Derrin Dyson, 17, and a 13-year-old, whose name was withheld. Scott, Samuels and the 13-year-old made incriminating statements of a criminal sex act, sex abuse and forcible touching and weapons possession, sources said.

Derrin denied having a gun or sexually assaulting the 22-year-old victim. The 13-year-old faces an additional rap for allegedly waving the gun around and threatening the victim, sources said.

At least three of the four have prior arrests, sources said.

“They hit the big leagues with this one,” one law enforcement source said.