Patriots tight end Rob Gronkowski was the Hamlet of the offseason as he mulled whether to retire. There was buzz, too, about a possible trade.

Gronkowski eventually agreed to a reworked contract and really wasn’t going to walk away from the game at the age of 29, but it was a pretty close call. It was also a near thing that he wasn’t dealt away by New England.

There nearly was a deal in place with an unnamed team, the NFL Network’s Ian Rapoport reported Sunday. However, Gronkowski told the Patriots that he would retire rather than play for and with anyone other than New England, Bill Belichick and Tom Brady.

He had been upfront about considering retirement after the Super Bowl loss to the Philadelphia Eagles and wanted to continue to work out with Alex Guerrero, Brady’s TB12 controversial trainer and business partner. Gronkowski has had a number of injuries and surgeries over his career and, like Brady, became a Guerrero devotee.

By April, he had decided to return, and, according to Rapoport, Gronkowski huddled with Belichick and his agent, Drew Rosenhaus, and agreed to rework his contract.

“I met with coach today and informed him I will be back for the 2018 season with the Pats,” Gronkowski wrote on his Instagram account in April. “I have been working out, staying in shape and feel great.

“Looking forward to another championship run.”

Can you blame Gronkowski for not wanting to play elsewhere? He has been virtually unstoppable with the Patriots, catching 474 passes for 7,179 yards and 76 touchdowns.

Read more from The Post: