Leave before the cake is cut.
It's understandable that people's schedules can be hectic. So if you made obligations the same weekend as the wedding (even though you knew about the wedding for a whole year) it's perfectly fine. But if you don't have a good excuse, try to at least stay until the cake is cut. That way it doesn't look like their whole guest list bailed on them. Share in the joy of the newly married couple. And most importantly, have a great time!