Yes, the quality of the school does matter. It isn't the only determining factor in how a child will turn out, but it is one factor.
Do note that I teach high school, and I'm thinking of that age group more than elementary children.
Also note that I'm talking about schools as if two types exist: Wonderful, top-level schools with every benefit and supportive parents lined up out the door . . . and inner city schools that teach only remedial classes taught in classrooms with broken windows and no heat. We tend to talk this way when we're discussing differences, but in reality the vast, vast majority of schools are in the middle. If you're in a D-grade school and have a chance to move to an A-school, clearly it's in your child's best interest. But most of us won't face that choice. More of us would find ourselves living in a C-level school district and have the choice to move to a B-level school. That's a harder choice, and I'd say that when the difference is likely to be small -- assuming you're happy with where you live -- it's probably better to provide enrichment at home (which all good parents do anyway) rather than move to a slightly-better school.
Anyway, does the quality of the school matter? I say yes:
Children are influenced by their peer group. If your kid attends a school where the majority of the boys belt their pants below their buttocks and where the girls consider it acceptable to have a baby at 14, your kid will pick up some of these values. I'd assume everyone on this site is raising their children in a more middle-class mode, but still, a kid who sees these behaviors around him will think, 'Okay, this is the world." In contrast, a kid who attends a school where most of his peers are college-bound will benefit from a more positive group mentality.
Likewise, a school that has a population of upper-level students will offer activities tailored to them: Debate team, Book club, Model UN, Science Club, etc. -- and they'll have a good turn-out for these activities. In contrast, a low-level inner city school will offer English-as-a-second-language classes in the evenings.
The best teachers in a school system can choose to go where they want. Okay, this isn't policy, but it's reality. The best teachers will choose to work in schools with better working conditions, with students with whom they can make a difference.
The best schools will offer a greater variety of AP classes and other higher-level options for your student. Sure, you can take the AP test without having taken the class, but in most situations the student really does need the class to have a shot at passing. Colleges have been saying forever that the #1 predictor of success in college is not GPA or SAT . . . it's the rigor of the high school courses the student chose. So the student who takes AP math and makes a C is better prepared for college than the one who took only the minimal-level math and made an A. Colleges look at both grades AND class selection.
As for me, myself, I went to a country high school. It was populated by farm kids, most of who were not going on to higher education. Our graduating class was about 160, and only about 20 of us went on to college. We had AP classes available to us, and we in that small group took every one of them together -- we were something of a school within a school. But we had only one option for foreign language. If we wanted something beyond Trig, we had to travel to the nearby community college -- which many people did. The school was providing an excellent education for the majority of the students, but those of us who were genuinely academic and were college-bound didn't have so many options as our counterparts in neighboring cities. As such, when I got to college I realized that I had been an A+ student in high school, had topped out my SATs and so forth . . . but initially I found college a pretty big "step up". I love the area where I grew up, and I intend to retire to that same place, but we've chosen to raise our children in an area with a better school system. Now that I have one in college, I can say that she graduated from high school better prepared than I did.