Go to your local dealer and see how it fits. Take a test drive, drive it home, and see how many people can fit into it comfortably.
Here are two photos I happen to have of mine. For the record, I'm aware that the kids aren't safe in adult buckles. We'd just brought the 5 home the previous night, and they were quite excited by it.
(My M5 is Galaxy Gray)
The depth of the rear compartment is 13 inches at the base and 4 inches at the top with the seats folded up.
You won't be able to fit a stroller in there with the seats up, unless it's a
really small umbrella style. I've got a Phil & Ted E3 (a double), and that requires at least one seat to be down. You could probably lay a stroller in the passenger area, but that's a tight fit. I'm assuming that you've got a double or triple stroller.
There's not even a remote chance that you could fit a pet carrier in there with all the kids. With the back row seats up, you've got very little space; essentially, none. You might have trouble fitting the box that the pet carrier came with, even folded up for recycling. Think of it this way - you can fit some cargo in the Mazda5, and some of that cargo can be people.
As for groceries, I propose an alternative: my wife takes one of the kids out shopping on Sunday mornings. The other kid stays behind with me and I use the time to clean the house.
WARNING: READ THE MANUAL BEFORE SITTING A CHILD IN AN AIRBAG-EQUIPPED SEAT.
If that doesn't work, your oldest (4 years old?) may be able to ride in the front in a front-facing carseat. If I remember correctly, the Mazda5 has a sensor to determine the weight of the passenger, and if they are too small (under 75 pounds) the airbag won't deploy. Mazda won't guarantee that, and obviously, neither will I, but it's an option. That would give you one folded down seat's worth of room in the back, which would be enough for a pet carrier or a week's groceries. If that makes you uncomfortable, you could put the groceries or the pet carrier in the front passenger seat. I wouldn't put my kids in an airbag seat.
There's LATCH / UAS in the two middle seats only. There are anchors for all four rear seats.
Now, getting into the rearmost seats will present a challenge. You've got 4, so all four will likely be in seats. Once the middle seats are full of carseat, they don't fold forward very much anymore. You can still adjust them a little (as with any other seat), but they become essentially stuck. They won't move at all unless you use LATCH/UAS. Bending over to fasten the carseat buckles in the third row will be an exercise in agility. It may be easiest to fit them from the back.