making a bottle / container with cap, but not round, need edges to line up

I'm making a bottle / container. I'm not sure how to ensure that the cap will screw on and seat with the edges lining up.  if it's just a round cap, it's easy no corners to worry about. but if it has corners / features on the cap that need to line up with like features on the bottle / container, how do you go about ensuring that once it screws on it's seat so the edges line up nice. 

Any push in the right direction would be helpful

thanks.

SolidworksSketching