To a large extent, "positions" aren't defined in the NFL - there's nothing that says that only "a quarterback" can do stuff which a quarterback normally does. If the Patriots wanted Edelman to throw a pass, they can do that, whether that be for one play or the rest of the game. They could equally do this with a running back, a cornerback or any other player, and they can do it no matter if the "regular" quarterbacks are injured or not.
The only slight complication here is that players are assigned numbers based on their position, and certain numbers (50-79) are reserved for offensive linemen who are not eligible to catch a pass. However, any ineligible player can make themselves "eligible" for one play by reporting to the referee, so if a team really wanted to put an offensive lineman in at quarterback, they'd simply have to report in before every play (the quarterback is an eligible receiver, even if they're not normally going to catch a pass).