If you want some thing more complex, like having any shape constrained inside any other shape, it becomes more complex.
It would be slightly easier if we had access to the position of the collision polygon's vertices.
Then we could do some math ourself to check if one of the point of the dragged object is outside of the constraining shape.
Then it would be a matter of keeping in memory the previous position of the object and interpolating between this position and the position the object would be if there were no constraint by running a loop to approximate the position the shape should be to stay within the constraints.
Using multiple objects to build the constraining area would be a possible solution but, to me, it would look quite messy to set up.