Clarification on how anchors interact with intervals

Hello! I am building a subscription application and I am a bit confused on how anchors interact with intervals.

During development I was originally under the assumption that anchors and intervals were mutually exclusive, I thought the anchors divided the calendar year into a set number of intervals depending on the length of interval chosen. That does not appear to be the case.

For example, lets say I want to have a 3 month subscription interval. This divides the calendar year into 4 segments. Now lets say I have an anchor set for 15 MONTHDAY (15th of the month). How does shopify know which 15th of the month to pick in the interval? Month 1, Month 2, or Month 3?

Could you please provide an example of a selling plan object which uses a quarterly billing and delivery cycle using anchors so we may see a correct example as the subscriptions API intends, there is one example in the selling plan documentation but it is only for a single anchor.

Assume all quarters must be billed on the last Monday of the quarter.

Q1: January 1st - March 31st

Q2: April 1st - June 30th

Q3: July 1st - September 30th

Q4: October 1st - December 31st

It would also be helpful to update the documentation here to include examples of odd interval/anchor combinations. Usage examples are given but no implementation examples.

Thank you!

Okay I think I came up with a mental model of how it should work for a single anchor, no idea how it would work for multiple. Basically I think, the way it works is, customer places order → shopify calculates next billing date without anchors, ie contract is set for 1 Month so shopify calculates from Jan 5th to Feb 5th. If the contract is 3 months then it calculates from Jan 5th to April 5th Then shopify looks at the first anchor and works backwards to the first date that satisfies the anchor condition. So if the anchor is for Weekday 1 it will work backwards from Feb 5th to the first monday. If its Monthday 15, it will work backwards to Jan 15th. And if no date satisfies the anchor, ie something like Dec 1st then the billing date will just be set for the initial interval.

Can anyone confirm if this is correct? If so that leaves me confused on how YEARDAY works, since that implies you could only have a single anchor for the entire year