What to do on a desk reject of a revised paper?
Something out of the ordinary clearly happened. It's not professional to reject a paper as being out of scope after it's been revised. My speculative guess is that the editor-in-chief is not very active, and the assistant editor was trying to keep things moving on her own initiative. The letters you received might well be automated emails with automated signatures by the editor-in-chief, i.e. the EiC didn't actually handle your manuscript. However this is pure speculation, and can be completely wrong.

Suggestions on what to do now: if you received a personalized letter from the editor-in-chief saying your paper is out of scope, don't bother appealing the decision and submit it elsewhere. Otherwise, you can write back to the journal to check if there was a mistake, pointing out that one of the reviewers did, after all, say your paper was within scope + useful to the field. I would not be very hopeful, but it's an option.