Sounds like it could potentially be a misfire caused by either poor air flow at idle, worn components, timing chain or a fuel system problem, along with anything from carbon build-up, clogged injectors or worn engine/box mounts. Watching an engine running on 3/4 cylinders lets you physically see the engine:
- Shaking around - The engine's crankshaft is balanced with each explosion from each cylinder in mind. If one's missing, it'll throw it out of sync.
- Slowing down - The engine is only having three quarters, so for the first three quarters, the engine is essentially keeping a constant speed, then the missing combustion would cause the engine to slow down a tiny amount, which also increases number 1.
However, you've also stated that it feels fine when the engine is warmed up. This tells me something could be worn. When things get hot, stuff expands. That's the same reason F1 engines need heating up before a race, and why train tracks have gaps between each piece of metal rail. When the engine is cold, there could be a minute gap on something, causing it to allow parts to move. This may or may not throw a code as it would be classified as a knock-detection sensor.
It could also be to do with an idle air valve; At idle, the butterfly valve that allows air into the inlet manifold is completely sealed, allowing only a tiny amount of air through either a specific valve or a tiny, tiny channel along the edge that bypasses the valve itself. This might be clogged or akin. However, this should throw a code.
It could also perhaps be a timing belt/chain, depending on which your car has. If it's even slightly worn, it could be either advancing or retarding your timing depending on how severe it is. If this is allowing fuel into the chamber AFTER the spark plug has already been set off, it's not combusting the fuel, therefore creating a miss-fire problem. However, this should throw a code.
It could also potentially be an injector problem or a fuel pressure problem. If the fuel pressure isn't high enough, it may not disperse the fuel into the combustion chamber optimally, and if the injector is having the dreaded squirt-squirt-squirt-sneeze problem that some Mazdas suffer from (inside joke from some Mazda workshops where I live) it could be that one of them is allowing too much fuel or too little into the combustion chamber, not allowing a total combustion or any whatsoever. However, this should throw a code.
There's probably many, many more problems, but these are the basic diagnostics for most petrol vehicles that run a timing chain, 4-cylinder configuration with a poor idle.
Good luck, I've always been a fan of the Mazda vehicles, though not necessarily their engines.... :P