The 24-year-old made 42 appearances for Rovers in 2016-17 but was out of contract at the end of June.
He helped the Prenton Park side finish second in the National League before defeat by Forest Green in the promotion final.
"I'm buzzing. It's taken a week or so to sort everything out but now it's done I'm made up," he told the club website.
Find all the latest football transfers on our dedicated page.
Rotherham have signed Tranmere defender Michael Ihiekwe on a two-year deal.