Did you miss an episode?
At the end of The Pandorica Opens, River Song dies with the TARDIS, Amy is dying, the Doctor is locked up, and Rory, as we know him, doesn't exist.
I know time is less like a straight line and more like timey wimey spacey wacey mumbo jumbo, but in-universe, what actually happened?
Your question seems to omit the follow-up episode (The Big Bang). Some of these questions are directly (and immediately) answered in the next episode. The Pandorica Opens is only half of the story.
River Song dies with the TARDIS
No she didn't. The TARDIS kept her in a time loop. She's been stuck in that time loop for about 2000 years until the Doctor saves her from it. This is explicitly shown.
Amy is dying
The Doctor placed her in the Pandorica. The Pandorica is built in a way that it does not allow the prisoner to die. 2000 years later, a fully healed Amy steps out of the Pandorica.
The Doctor is locked up
See the previous bullet point. The (future) Doctor travelled back to Rory, gave him the sonic and told him what to do.
Rory then frees the (present) Doctor, they put Amy in the Pandorica, and Rory puts the (future) sonic into Amy's pocket (which is then retrieved by the future Doctor in his future).
and Rory, as we know him, doesn't exist.
If you mean "as we know him" as human, then he has indeed not existed ever since his timeline was erased.
If you mean "as we know him" as an Auton, then that Rory is still alive. After they put Amy in the Pandorica, Rory decides to stay with the Pandorica in order to keep Amy safe, thus waiting for about 2000 years.
This is later proven, when after 2000 years, Rory (dressed as a security guard) uses the gun from his hand to kill a Dalek that came back to life. This proves that Rory is still Auton Rory (it also explains how he's been able to live for 2000 years).
The meaning of "Big Bang Two"
When everything is "restored" and everyone lives, including Rory and later River Song, did they ever die? Is that part of history gone except in the memories of the time travellers? Is that the end of River Song according to her personal timeline? Was that her actual death?
From your question, I gather that you understand the nature of Rory's death. He didn't just die, he was erased from time itself, and everyone forgot about him.
When Big Bang Two happens, the crack in time itself gets similarly erased. Not only does it disappear, but the universe removes any evidence of its existence.
This is not a rewind of time, rather a reshuffle of the universe (across time and space).
- Amy's parents return, and they act as if they've never been away. Amy herself seems to be surprised to see her mom and dad, but both her mom and her dad act as if nothing weird has ever happened.
- Amy is getting married to Rory. This is the initial wedding of Amy and Rory (when the Doctor first met her, Amy ran off with him on the night before her wedding). But in the restored timeline, since there is no Doctor, the wedding is taking place. Logically, this should mean that the Rory she is married to is human Rory.
- The Doctor hasn't completely vanished from existence. When Amy starts talking about her imaginary friend at the wedding, her mom mutters "not this again". This proves that Amy has already talked at length about the Doctor even though he doesn't actually exist. (I'll get back to this in a second)
I said that Big Bang Two is a reshuffle instead of a rewind.
A rewind would constitute that the past events are undone. However, this is not the case:
- Amy is able to remember Rory (in The Pandorica Opens) even though he's supposed to be erased from time itself.
- Amy thinks it's weird to see her mom and dad again, even though they have always been there (according to the new timeline).
- Even in the new timeline, Amy talks about her imaginary friend The Doctor. Note that Amy only met the Doctor when her parents had already disappeared in the crack! This means that Amy is remembering something that logically could have never happened (in the new universe, the crack never existed, and neither did the Doctor).
- Human Rory remembers being an Auton. Which makes no sense, since human Rory never was an Auton, they were two completely different entities.
The only logical explanation is that the existing people were "reused" for the new universe (post Big Bang Two). Instead of deleting and creating everything from scratch, the universe instead changed itself to its new shape, but it did not actually start from scratch.
For Rory specifically: When the reshuffle happened, Auton Rory was pretty close to human Rory (same character, same memories). You could say that his soul was the same, only his body was different. It's possible that the universe morphed Auton Rory into human Rory (rather than create Rory from scratch), which would explain why human Rory remembers being Auton Rory.
The only people who are able to remember things that they shouldn't be able to (Amy, Rory, River, the Doctor), are all people who have travelled in the TARDIS. And this has been addressed before: The Doctor and his companions can remember what happened in a timeline before it was altered, because the TARDIS allows them to remember it and protects them from having their memory "rewritten" by the universe.