Your observation is correct: a query to a sharded collection just has to include all of the fields in a compound shard key index (in any order) to target the shards that may contain matching documents.
In the more general case, the order of keys in a query does not have to match the order of keys in a compound index definition. However, the order and direction of keys in a compound index definition is definitely important and should follow guidelines like the ESR (Equality, Sort, Range) Rule.
You can explain query results to confirm which indexes are used and which shards are accessed for a query.