Rewrite for generality and fix for pyregion behaviour on WCS-based regions